
#ifndef _STATE_H_
#define _STATE_H_
#include <iostream>
#include <map>
#include <vector>
using namespace std;


class State {
	public:

		/** Constructor
		 *  param v coordinates of the State.
		 *  param reward Reward for this State (0 = wall, 1 = free tile, 2 = goal).
		 *  param value Value for this State (will be computed during the iteration).
		 *  param neighbor Map of pointers to neighboring States referenced by action leading to each.
		 */
		virtual bool init(const vector<double> v, double reward, double value, double policy, map<double, State> neighbor);
		
		/** Constructor
		 *  param v coordinates of the State.
		 *  param reward Reward for this State (0 = wall, 1 = free tile, 2 = goal).
		 *  param value Value for this State (will be computed during the iteration).
		 */
		virtual bool init(const vector<double> v, double reward, double value, double policy);

		/** Destructor
		 */
		virtual bool deinit();
		

		/** addNeighbor
		 *  Adds a neighboring State to the map of surrounding states
		 *  param action The action that leads to the resulting State (Key)
		 *  param s Pointer to the State the action leads to (Value)
		 */
		virtual bool addNeighbor(const double action, State* s);
		
		
		// The reward the state has
		double reward;
		
		// The computed value of the state
		double value;

		// The policy in form of the output action
		double policy;
		
		// the coordinates of a state
		vector<double> coords;
		
		// map of neighboring States with the action that leads to them as keys
		map<double, State> neighbors;		
	
};	
	
	
#endif
	